package com.hong.qrpc.utils;

import java.io.IOException;
import java.net.ServerSocket;

/**
 * @Author HQT
 * @Date 2022/10/14 17:14
 */
public class NetUtils {
    public static int getIdlePort() throws IOException {
        ServerSocket serverSocket = new ServerSocket(0); //读取空闲的可用端口
        int port = serverSocket.getLocalPort();
        return port;
    }
}
